package com.nefu.softlab.xjwc.utils;

import com.nefu.softlab.xjwc.common.Constant;
import com.nefu.softlab.xjwc.mapper.RedisMapper;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.UUID;

/**
 * @author : Ar1es
 * @date : 2020/1/12
 * @since : Java 8
 */
public class MD5 {


    public static Object MD5(String userName, String password) {
        String algorithms = "MD5";

        int hash = 1024;//加密次数

        ByteSource byteSource = ByteSource.Util.bytes(userName);

        Object object = new SimpleHash(algorithms, password, byteSource, hash);

        return object;
    }


    public static void main(String[] args) {
        System.out.println(MD5("admin1", "admin1"));

        System.out.println(UUID.randomUUID().toString().replace("-", ""));
    }

}
